const app = getApp()

Page({
  data: {
    fileList: [],
    item: {},
  },

  handleCheckUrl(event) {
    let { img } = event.currentTarget.dataset
    console.log(img)
    wx.previewImage({
      current: img, // 当前显示图片的http链接
      urls: [img], // 需要预览的图片http链接列表
    })
  },

  handleOkUrl(event) {
    let { img } = event.currentTarget.dataset
    console.log(img)
    wx.previewImage({
      current: img, // 当前显示图片的http链接
      urls: [img], // 需要预览的图片http链接列表
    })
  },

  onLoad: function (options) {
    let listObj = JSON.parse(options.item)
    this.setData({
      item: listObj,
      'fileList[0].url': listObj.checkUrl,
    })
  },

  onShow: function () {
    const userInfo = wx.getStorageSync('userInfo')

    console.log(userInfo.userType)

    if (userInfo.userType == 1) {
      if (wx.getStorageSync('YHZG_Edit')) {
        wx.setNavigationBarTitle({
          title: '隐患排查',
        })
      } else {
        wx.setNavigationBarTitle({
          title: '隐患整改',
        })
      }
    } else {
      if (wx.getStorageSync('YHPC_Edit')) {
        wx.setNavigationBarTitle({
          title: '隐患整改',
        })
      } else {
        wx.setNavigationBarTitle({
          title: '隐患排查',
        })
      }
    }
  },
})
